
<#include "/base/common/head.html"/>
    
    <table id="dg"></table>
    <div id="tb" style="padding:2px 5px;">
        <div class="wrap_search">
		        		
        </div>
        <div style="text-align: left; margin:6px;">
        	<!--  
            -->
            <a href="javascript:void(0)" class="easyui-linkbutton updateBtn" iconCls="glyphicon-pawn" plain="true" onclick="update()">审核</a>
            
            <div id="searchBtnWrap" style="float:right; padding-right:40px;">
                <a href="javascript:void(0)" class="easyui-linkbutton color1" iconCls="glyphicon-search" onclick="zcurdSearch()">搜索</a>
                <a href="javascript:void(0)" class="easyui-linkbutton color2" iconCls="glyphicon-repeat" onclick="flushPage()">重置</a>
            </div>
            
        </div>
    </div>
    
<style type="text/css">
	.subtotal { font-weight: bold; }/*合计单元格样式*/
</style>

<script type="text/javascript">

//数据表格初始化参数
var dgOptions = {
        rownumbers:true,
    	fit:true,
    	border:false,
    	url:'listData',
    	method:'post',
    	toolbar:'#tb',
    	pageSize: 20,
    	pagination:true,
    	//fitColumns:true,
    	striped:true,
    	multiSort:false, //是否允许多列排序
		sortName:'opeTimeNear', //初始排序字段
		sortOrder:'desc', //初始排序方式
    	singleSelect: false,
		ctrlSelect : true,
		showFooter : true,
        queryParams: zcurdGetParam(),
        onDblClickRow:function(index, row){updateOne(row.id);},
        columns: [[
		         {field:'id', checkbox:true}
	           	 ,{field:'beginTime', title: '出发时间', width:110, align:'center'}
	           	 ,{field:'user', title: '用车人', width:100, align:'center'}
	           	 ,{field:'destination', title: '目的地', width:100, align:'center'}
	           	 ,{field:'remark', title: '备注', width:200, align:'center'}
	           	 ,{field:'applyUserName', title: '申请人', width:100, align:'center'}
	           	 ,{field:'opeTimeNear', title: '提交时间', width:130, align:'center'}
	           	 
	           ]],
	      loadFilter: function(data) {
	        	   if(data.result && data.result == 'fail') {	//失败时，错误消息提示
	        		   showWarnMsg(data.msg);
	        		   return {};
	        	   }else {
	        		   return data;
	        	   }
	           }           
	};
	

var datagrid = $("#dg"); //数据表格

$(function() {
	datagrid.datagrid(dgOptions); //绘制数据表格
	autoAddClear(); //为各组件自动填加‘清除’功能（组件需要增加 addClear属性 ）
});

//查询
function zcurdSearch() {
	var param = zcurdGetParam();
	datagrid.datagrid("load", param)
}

//获取查询参数
function zcurdGetParam() {
	var param = {};
	$("#tb :input[name]").each(function(i, item) {
		if($(item).val()) {
			param[$(item).attr("name")] = $(item).val();	
		}
	});
	//console.log(param);
	return param;
}

var initPara = zcurdGetParam(); //初始化参数，主要目的是保存一些隐藏条件


//修改
function update() {
	var rowsSel = datagrid.datagrid("getChecked");
	if(rowsSel.length != 1) {
		showWarnMsg("请选择一条数据");
		return;
	}

	var id = rowsSel[0].id;
	updateOne(id);
}

function updateOne(id) {
	top.window.subPage.loadCurrDatagrid = function() {
		datagrid.datagrid("reload");
	}
	top.openWindow("审核", getCurrUrl("updatePage") + "?id=" + id, {size: '480x380'});
}


</script>

<#include "/base/common/dialogWindow.html"/>
<#include "/base/common/foot.html"/>
